package app.server.project.main.service.dto.race;

import app.server.project.main.service.db.entity.cfg.RaceCfgEntity;
import app.server.project.main.service.db.entity.user.UserRaceEntity;
import cn.hutool.core.bean.BeanUtil;
import lombok.Data;

@Data
public class RaceValDto {


    private String val;
    private String rate;
    private int raceId;

    public static RaceValDto of(UserRaceEntity userRaceEntity, RaceCfgEntity raceCfgEntity) {
        RaceValDto userRace = new RaceValDto();
        BeanUtil.copyProperties(raceCfgEntity, userRace, true);
        BeanUtil.copyProperties(userRaceEntity, userRace, true);
        userRace.setRate(String.valueOf(raceCfgEntity.getRate()));
        userRace.setVal(String.valueOf(userRaceEntity.getVal()));
        return userRace;
    }

    public static RaceValDto ofTon(long tonVal, long rate) {
        RaceValDto userRace = new RaceValDto();
        userRace.setVal(String.valueOf(tonVal));
        userRace.setRate(String.valueOf(rate));
        return userRace;
    }
}
